﻿using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace OpenQuant.Quik.Design
{
    public class QuikPathConvertor : StringConverter
    {
        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            return true;
        }

        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
        {
            return true;
        }

        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            var q = Process.GetProcessesByName("info").
                Select(p => new FileInfo(p.MainModule.FileName).DirectoryName).ToArray();
            return new StandardValuesCollection(q);
        }
    }
}
